import sys, os
if hasattr(sys, 'frozen'):
    os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']

from PyQt5.QtWidgets import QApplication
from bot_log import BotLogger
from invoice import *
from utils import *

logger = BotLogger(os.path.basename(__file__), logname=1).getLogger()

if __name__ == '__main__':

    if not load_config():
        sys.exit()

    try:
        init_db()
    except Exception as e:
        logger.error(str(e))
        logger.error("初始化数据库文件失败！")
        sys.exit(1)

    app = QApplication(sys.argv)
    myWin = Ui_Inv()
    myWin.setupUi()
    sys.exit(app.exec_())